public class Leaf implements Component {
    private String name;

    public Leaf(String name) {
        this.name = name;
    }

    @Override
    public void add(Component c) {
        System.out.println("Leaf cannot add components.");
    }

    @Override
    public void remove(Component c) {
        System.out.println("Leaf cannot remove components.");
    }

    @Override
    public void display(int depth) {
        System.out.println(" ".repeat(depth * 2) + name);
    }
}